<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('新员工入职管理')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-editable-css"/>

</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <input type="hidden" id="ComPidorDepTid" name="ComPidorDepTid">
                    <div class="select-list">
                        <ul>
                            <li>
                                姓名：<input type="text" name="name"/>
                            </li>
                            <li>
                                工号：<input type="text" name="badge"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addFull()">
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a class="btn btn-primary" onclick="entryEdit()">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                &nbsp;&nbsp;&nbsp;
                <a class="btn btn-success" onclick="entryBackground()">
                    <i class="fa fa-plus"></i> 入职背景
                </a>
                <a class="btn btn-primary" onclick="cc('eSP_StaffCheck')">
                    <i class="fa fa-edit"></i> 确认检查
                </a>
                <a class="btn btn-danger" onclick="cc('eSP_StaffCancel')">
                    <i class="fa fa-remove"></i> 取消确认
                </a>
                <a class="btn btn-primary" onclick="cc('eSP_Staffbadge')">
                     分配工号
                </a>
                <a class="btn btn-primary" onclick="cc('eSP_StaffStart')">
                    执行入职处理
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>

<script th:inline="javascript">
    var prefix = ctx + "entryManage/newEmpRegister";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 800) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 350});
        queryData();
    });

    function entryEdit() {
        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            $.modal.alertWarning("请选择要修改的数据");
            return;
        }
        if (row.length > 1) {
            $.modal.alertWarning("只能选择一条数据");
            return;
        }

        $.operate.editFull();
    }

    function queryData() {
        var columns = [];
        var checkbox = {checkbox: true};
        var badge = {field: 'badge', title: '工号'};
        var name = {field: 'name', title: '姓名'};
        var compId = {field: 'compId', title: '公司名称'};
        var DepId = {field: 'DepId', title: '部门名称'};
        var JobId = {field: 'JobId', title: '工作岗位'};
        var JobGrade = {field: 'JobGrade', title: '岗位级别'};
        var ReportTo = {field: 'ReportTo', title: '直接上级'};
        var WFReportTo = {field: 'WFReportTo', title: '职能上级'};
        var EmpType = {field: 'EmpType', title: '员工类别'};
        var hxgg = {field: 'hxgg', title: '核心高管'};
        var WorkCity = {field: 'WorkCity', title: '工作城市'};
        var EMail = {field: 'EMail', title: '公司邮箱'};
        var office_phone = {field: 'office_phone', title: '办公电话'};
        var archiveid = {field: 'archiveid', title: '档案号'};
        var JoinType = {field: 'JoinType', title: '入职渠道'};
        var JoinDate = {field: 'JoinDate', title: '入职日期'};
        var Cyear_Adjust = {field: 'Cyear_Adjust', title: '司龄调整'};
        var WorkBeginDate = {field: 'WorkBeginDate', title: '参加工作时间'};
        var PracBeginDate = {field: 'PracBeginDate', title: '实习开始日期'};
        var PracTerm = {field: 'PracTerm', title: '实习期限'};
        var PracEndDate = {field: 'PracEndDate', title: '实习终止日期'};
        var ProbBeginDate = {field: 'ProbBeginDate', title: '试用开始日期'};
        var ProbTerm = {field: 'ProbTerm', title: '试用期限'};
        var ProbEndDate = {field: 'ProbEndDate', title: '试用终止日期'};
        var ConType = {field: 'ConType', title: '合同类型'};
        var ConProperty = {field: 'ConProperty', title: '合同属性'};
        var Contract = {field: 'Contract', title: '签约单位'};
        var ConBeginDate = {field: 'ConBeginDate', title: '合同开始日期'};
        var ConTerm = {field: 'ConTerm', title: '合同期年'};
        var ConEndDate = {field: 'ConEndDate', title: '合同结束日期'};
        var Country = {field: 'Country', title: '国籍和地区'};
        var Nation = {field: 'Nation', title: '民族'};
        var CertType = {field: 'CertType', title: '证件类型'};
        var CertNo = {field: 'CertNo', title: '证件编号'};
        var Gender = {field: 'Gender', title: '性别'};
        var BirthDay = {field: 'BirthDay', title: '出生日期'};
        var Resident = {field: 'Resident', title: '籍贯'};
        var certaddress = {field: 'certaddress', title: '身份证地址'};
        var Marriage = {field: 'Marriage', title: '婚姻状况'};
        var Party = {field: 'Party', title: '政治面貌'};
        var army = {field: 'army', title: '是否参军'};
        var leavearmy = {field: 'leavearmy', title: '退伍部队'};
        var HighLevel = {field: 'HighLevel', title: '最高学历'};
        var highschool = {field: 'highschool', title: '最高学历毕业院校'};
        var highenddate = {field: 'highenddate', title: '最高学历毕业时间'};
        var Major = {field: 'Major', title: '最高学历专业'};
        var HighTitle = {field: 'HighTitle', title: '最高职称或资格证书'};
        var Address = {field: 'Address', title: '现在住址'};
        var Tel = {field: 'Tel', title: '联系电话'};
        var eMail_pers = {field: 'eMail_pers', title: '私人邮箱'};
        var EmergencyName = {field: 'EmergencyName', title: '紧急联系人'};
        var emergencytel = {field: 'emergencytel', title: '紧急联系人电话'};
        var Constellation = {field: 'Constellation', title: '星座'};
        var QQ = {field: 'QQ', title: 'QQ'};
        var Wechart = {field: 'Wechart', title: '微信'};
        var Remark = {field: 'Remark', title: '备注'};
        var RegBY = {field: 'RegBY', title: '登记人'};
        var RegDate = {field: 'RegDate', title: '登记时间'};
        var Initialized = {field: 'Initialized', title: '确认'};
        var INITIALIZEDby = {field: 'INITIALIZEDby', title: '确认人'};
        var INITIALIZEDtime = {field: 'INITIALIZEDtime', title: '确认时间'};
        var Ezid = {field: 'Ezid', title: '人事区域'};
        columns.push(checkbox, badge, name, compId, DepId, JobId, JobGrade, ReportTo,
            WFReportTo, EmpType, hxgg, WorkCity, EMail, office_phone,
            archiveid, JoinType, JoinDate, Cyear_Adjust, WorkBeginDate,
            PracBeginDate, PracTerm, PracEndDate, ProbBeginDate, ProbTerm,
            ProbEndDate, ConType, ConProperty, Contract, ConBeginDate, ConTerm,
            ConEndDate, Country, Nation, CertType, CertNo, Gender, BirthDay,
            Resident, certaddress, Marriage, Party, army, leavearmy, HighLevel,
            highschool, highenddate, Major, HighTitle, Address,
            Tel, eMail_pers, EmergencyName, emergencytel, Constellation, QQ, Wechart, Remark, RegBY, RegDate, Initialized, INITIALIZEDby, INITIALIZEDtime, Ezid);
        var options = {
            code: "id",
            uniqueId: "id",
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            detailUrl: prefix + "/detail/{id}",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            sortOrder: "desc",
            modalName: "新员工入职登记",
            columns: columns
        };
        $.table.init(options);
    }

    function entryBackground() {
        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择一条职员");
            return;
        } else if (row.length > 1) {
            alert("只能选择一条职员");
            return;
        }
        $.modal.openFull(row[0].name + ":职员信息", ctx + "entryManage/newEmpRegister/entryBackground?id=" + row[0].id);
    }

    function cc(procedure){
        var allId = "";
        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].id
            } else {
                allId += row[i].id + ","

            }
        }
        $.ajax({
            url: prefix + "/procedure",
            data: {"allId": allId, "procedure": procedure},
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.data == null) {
                    $.modal.alertWarning(data.message);
                } else {
                    $.modal.alertSuccess(data.data);
                }

                $.table.refresh();
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    }

</script>
</body>
</html>